package com.heima.article;

import com.heima.file.service.FileStorageService;
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@SpringBootTest//(classes = ArticleApplication.class)
public class UploadMinIO {
    //将硬盘上的静态页list.html上传到minio
    @Autowired
    @Qualifier("minIOFileStorageService")
    FileStorageService fileStorageService;
    @Value("${file.minio.readPath}")
    String readPath;
    @Test
    public void upload() throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream("E:\\list.html");
        String store = fileStorageService.store("test", "list.html", "text/html", fileInputStream);
        System.out.println(store);
        System.out.println(readPath + store);
    }
}


